<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>{{title}}</title>
    <meta name="description" content="KoBoToolbox is a free toolkit for collecting and managing data in challenging environments and is the most widely-used tool in humanitarian emergencies">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {# From the Django documentation: the `url` tag "Returns an absolute path reference (a URL without the domain name)" #}
    <meta name="kpi-root-path" content="{% url 'kpi-root' %}">
    {% if csrf_token %}<meta name="csrf-token" content="{{csrf_token}}">{% endif %}

    {% if raven_js_dsn %}
      <script src="https://cdn.ravenjs.com/3.22.3/raven.min.js" crossorigin="anonymous"></script>
      <script>
        Raven.config('{{raven_js_dsn}}').install()
      </script>
    {% endif %}

    {% load render_bundle from webpack_loader %}
    {% load static %}

    <link rel="apple-touch-icon" sizes="180x180" href="{% static 'apple-touch-icon.png' %}" />
    <link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon-32x32.png' %}" />
    <link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon-16x16.png' %}" />
    <link rel="manifest" href="{% static 'site.webmanifest' %}" />
    <link rel="mask-icon" href="{% static 'safari-pinned-tab.svg" color="#2095f3' %}" />
    <link rel="shortcut icon" href="{% static 'favicon.ico' %}" />

    {% render_bundle 'app' 'css' %}
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
      <script>window.html5 || document.write('<script src="{% static 'js/vendor/html5shiv.js' %}"><\/script>')</script>
    <![endif]-->

    {% if config.logo %}
      <style>
        .mdl-layout__header .header__logo {
          background-image: url("{{ config.logo }}") !important;
        }
      </style>
    {% endif %}
    {% if config.logo_small %}
      <style>
        @media screen and (max-width: 767px) {
          .mdl-layout__header .header__logo {
            background-image: url("{{ config.logo_small }}") !important;
          }
        }
      </style>
    {% endif %}

    {% if intercom_app_id %}
    <script>
      window.IntercomAppId = '{{ intercom_app_id|safe }}';
    </script>
    {% endif %}
  </head>
  <body>
    <!--[if lt IE 8]>
      <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->
    {% block content %}{% endblock content %}

    {% block footer %}
      <!-- Make Django's internationalization functionality available in client code. -->
      <script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>

      {% render_bundle 'app' 'js' %}
      {% render_bundle 'vendors' 'js' %}

    {% endblock footer %}

    {% if google_analytics_token %}
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', '{{google_analytics_token}}', 'auto');
      ga('send', 'pageview');
    </script>
    {% endif %}
  </body>
</html>
